//
//  ZYCModifyDutyRecordHeaderView.m
//  ZDSC
//
//  Created by ZDTX on 2021/7/23.
//

#import "ZYCModifyDutyRecordHeaderView.h"
#import "ZYCDutyBulletionRecordDetailModel.h"
@interface ZYCModifyDutyRecordHeaderView ()

@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *dutyNamesLabel;
@property (nonatomic, strong) UILabel *dutyRangeLabel;
@property (nonatomic, strong) UIView *bgView;

@end
@implementation ZYCModifyDutyRecordHeaderView
- (void)setModel:(ZYCDutyPlansRecordModel *)model{
    _model = model;
    _titleLabel.text = model.title;
    _dutyNamesLabel.text = [NSString stringWithFormat:@"值班人员:%@",model.dutyPersonnel];
    _dutyRangeLabel.text = [NSString stringWithFormat:@"值班范围:%@",model.scopeStr];
}


- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = HEX_RGB(kBgWhiteColor);
        [self addSubview:self.titleLabel];
        [self addSubview:self.dutyNamesLabel];
        [self addSubview:self.dutyRangeLabel];
        [self addSubview:self.bgView];
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(15.0f);
            make.right.equalTo(self).offset(-15.0f);
            make.top.equalTo(self).offset(20.0f);
        }];
        
        [self.dutyNamesLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(15.0f);
            make.right.equalTo(self).offset(-15.0f);
            make.top.equalTo(self.titleLabel.mas_bottom).offset(15.0f);
        }];
        
        [self.dutyRangeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(15.0f);
            make.right.equalTo(self).offset(-15.0f);
            make.top.equalTo(self.dutyNamesLabel.mas_bottom).offset(11.0f);
        }];
        
        [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.bottom.equalTo(self);
            make.top.equalTo(self.dutyRangeLabel.mas_bottom).offset(15.0f);
            make.height.mas_equalTo(5.0f);
        }];
    }
    return self;
}

- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [UILabel LabelWithFont:kSystemBoldFont(17) titleColor:HEX_RGB(kTitleThemeColor) textAlignment:ZZTextAlignmentLeft];
        _titleLabel.numberOfLines = 0;
    }
    return _titleLabel;
}

- (UILabel *)dutyNamesLabel {
    if (!_dutyNamesLabel) {
        _dutyNamesLabel = [UILabel LabelWithFont:kCustomFont(@"PingFangSC-Light", 14.0f) titleColor:HEX_RGB(@"888888") textAlignment:ZZTextAlignmentLeft];
        _dutyNamesLabel.numberOfLines = 0;
    }
    return _dutyNamesLabel;
}

- (UILabel *)dutyRangeLabel {
    if (!_dutyRangeLabel) {
        _dutyRangeLabel = [UILabel LabelWithFont:kCustomFont(@"PingFangSC-Light", 14.0f) titleColor:HEX_RGB(@"888888") textAlignment:ZZTextAlignmentLeft];
        _dutyRangeLabel.numberOfLines = 0;
    }
    return _dutyRangeLabel;
}


- (UIView *)bgView {
    if (!_bgView) {
        _bgView = [[UIView alloc] init];
        _bgView.backgroundColor = HEX_RGB(@"#F9F9F9");
    }
    return _bgView;
}
@end
